<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery-2.1.1.min.js"></script>
    <script src="js/loading.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>


<script>

$(function(){
    
    $("#xx").click(function(){
    	var filter=$("#search").val();
        if(filter){
            var lis=$("#list").find("li");
            $matches=headerPrefix(lis,filter);
            console.log($matches);
        }else{
            console.log("have none");
        }
         
    });
    
    function headerPrefix(objs,filter){
            var lis=Array();
            objs.each(function(num,elm){
                var item= $(elm).text();
                var index=item.indexOf(filter);
                if(index==0){
                    lis.push($(elm));
                }
            });
            return lis;
            
        }

});
    
    

</script>
    <title>test</title>
</head>
<body>
<h1 th:inlines="text">点击授权</h1>
<ul id="list">
    <li class="xx">asasdasd</li>
    <li>bfdasdf</li>
    <li class="xx">ctyrtrert</li>
    <li>dtrweqwq</li>
    <li>eyuyrqqw</li>
    <li>f8675467</li>
    <li>glolol</li>
    <li>htrwer</li>
    <li>itrwe</li>
    <li>a332</li>
    <li>bopii</li>
    <li>cassss</li>
</ul>
<input id="xx" type="button" value="xxx授权"/>
<input id="search" type="text"  placeholder="输入查询的字符串">
</body>
</html>
